package com.example.easyscript.common.util;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.cglib.CglibUtil;
import com.example.easyscript.enums.EnumUtils;
import io.swagger.models.auth.In;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MapUtil {

    public static <T, E> Map<T, E> getMap(List<T> keySet, Object e, Class<E> clazz) {
        Map<T, E> map = new HashMap<>();
        keySet.forEach(item -> {
            if (e instanceof Integer || e instanceof Boolean) {
                map.put(item, (E) e);
            }else{
                map.put(item, BeanUtil.copyProperties(e, clazz));
            }
        });
        return map;
    }

    public static void main(String[] args) {
        Integer a = 2;
        Object o = (Object) a;
        System.out.println((Integer) o);
    }

}
